<template>
  <div class="app">
    <h1>我是App组件（祖）,{{ name }}---{{ price }}</h1>
    <Child />
  </div>
</template>

<script>
import { reactive, toRefs, provide } from "vue";

import Child from "@/components/Child";
export default {
  name: "App",
  components: { Child },
  setup() {
    const car = reactive({
      name: "宝马",
      price: "40W",
    });

    provide("carInfo", car); //给自己的后代组件传递数据

    return {
      ...toRefs(car),
    };
  },
};
</script>

<style>
.app {
  background-color: pink;
  padding: 10px;
}
</style>